Skip to content

Api endpoint for image crops#4743

Merged
lindseydew merged 7 commits into
mainfrom
ld/api-endpoint-for-image-crops
May 27, 2026
Merged

Api endpoint for image crops#4743
lindseydew merged 7 commits into
mainfrom
ld/api-endpoint-for-image-crops

Conversation

@lindseydew

@lindseydew lindseydew commented May 19, 2026

Copy link
Copy Markdown
Contributor

What does this change?

This makes the crop options that grid supports available as an API endpoint so that the media atom maker service can use this to ascertain if a specific crop is already supported in grid, so if another one is needed

How should a reviewer test this change?

How can success be measured?

Who should look at this?

Tested? Documented?

  • locally by committer
  • locally by Guardian reviewer
  • on the Guardian's TEST environment
  • relevant documentation added or amended (if needed)

@lindseydew lindseydew added the maintenance Departmental tracking: maintenance work, not a fix or a feature label May 19, 2026
@github-actions

github-actions Bot commented May 19, 2026

Copy link
Copy Markdown

@lindseydew lindseydew changed the title Ld/api endpoint for image crops Api endpoint for image crops May 26, 2026
@lindseydew lindseydew marked this pull request as ready for review May 26, 2026 09:32
@lindseydew lindseydew requested a review from a team as a code owner May 26, 2026 09:32

@andrew-nowak andrew-nowak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

In the future we could look to replace the clientside constants https://github.com/guardian/grid/blob/main/kahuna/public/js/util/constants/cropOptions.js with a lookup to this new endpoint, which would allow different deployers of the grid to more easily configure different "supported" ratios

import play.api.mvc.{BaseController, ControllerComponents}

class ConfigurationController(override val controllerComponents: ControllerComponents) extends BaseController {
def cropVariations = Action { _ => Ok(Json.toJson(CropOption.supported)) }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worth a brief comment that this is intentionally without auth, for future travellers who might think it was an oversight and attempt to correct

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sounds good 👍

@gu-prout

gu-prout Bot commented May 27, 2026

Copy link
Copy Markdown

Seen on image-loader, leases, usage, kahuna (merged by @lindseydew 10 minutes ago) Please check your changes!

@gu-prout

gu-prout Bot commented May 27, 2026

Copy link
Copy Markdown

Seen on collections, thrall, media-api (merged by @lindseydew 10 minutes and 11 seconds ago) Please check your changes!

@gu-prout

gu-prout Bot commented May 27, 2026

Copy link
Copy Markdown

Seen on cropper, auth, metadata-editor (merged by @lindseydew 12 minutes and 17 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants